package com.linxiao.hrcrm.service.impl;

import java.util.List;

import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.linxiao.hrcrm.mapper.CrmWorksiteMapper;
import com.linxiao.hrcrm.domain.CrmWorksite;
import com.linxiao.hrcrm.service.ICrmWorksiteService;

import javax.annotation.Resource;

/**
 * 工地信息Service业务层处理
 *
 * @author zhoudong
 * @date 2024-01-03
 */
@Service
public class CrmWorksiteServiceImpl implements ICrmWorksiteService {
    @Resource
    private CrmWorksiteMapper crmWorksiteMapper;

    /**
     * 查询工地信息
     *
     * @param id 工地信息主键
     * @return 工地信息
     */
    @Override
    public CrmWorksite selectCrmWorksiteById(Long id) {
        return crmWorksiteMapper.selectCrmWorksiteById(id);
    }

    /**
     * 查询工地信息列表
     *
     * @param crmWorksite 工地信息
     * @return 工地信息
     */
    @Override
    public List<CrmWorksite> selectCrmWorksiteList(CrmWorksite crmWorksite) {
        return crmWorksiteMapper.selectCrmWorksiteList(crmWorksite);
    }

    /**
     * 新增工地信息
     *
     * @param crmWorksite 工地信息
     * @return 结果
     */
    @Override
    public int insertCrmWorksite(CrmWorksite crmWorksite) {
        crmWorksite.setCreateTime(DateUtils.getNowDate());
        return crmWorksiteMapper.insertCrmWorksite(crmWorksite);
    }

    /**
     * 修改工地信息
     *
     * @param crmWorksite 工地信息
     * @return 结果
     */
    @Override
    public int updateCrmWorksite(CrmWorksite crmWorksite) {
        crmWorksite.setUpdateTime(DateUtils.getNowDate());
        return crmWorksiteMapper.updateCrmWorksite(crmWorksite);
    }

    /**
     * 批量删除工地信息
     *
     * @param ids 需要删除的工地信息主键
     * @return 结果
     */
    @Override
    public int deleteCrmWorksiteByIds(Long[] ids) {
        return crmWorksiteMapper.deleteCrmWorksiteByIds(ids);
    }

    /**
     * 删除工地信息信息
     *
     * @param id 工地信息主键
     * @return 结果
     */
    @Override
    public int deleteCrmWorksiteById(Long id) {
        return crmWorksiteMapper.deleteCrmWorksiteById(id);
    }
}
